version: April 3, 2020

DOI

About this document


All analyses preformed with R version 3.6.1.

This is the code accompanies the publication Eckert RJ, Reaume AM, Sturm AB, Studivan MS and Voss JD (2020) Depth influences Symbiodiniaceae associations among Montastraea cavernosa corals on the Belize Barrier Reef. Front. Microbiol. 11:518. doi: 10.3389/fmicb.2020.00518. Here you will find all the code to repeat the statistical analyses performed for this manuscript. All of the accompanying data can be found on my GitHub.

Background


Here we sampled Montastraea cavernosa colonies from 4 different depth zones across 4 sites on the Belize Barrier Reef. We extracted holobiont DNA using a modified CTAB protocol and amplified the ITS2 region of algal symbiont (Family Symbiodiniaceae) DNA for sequencing on Illumina MiSeq (2 x 300 bp). We used the SymPortal analysis frame work to identify Symbiodiniaceae ITS2 type profiles within the coral host to examine variation with depth.

 

If you download my entire accompanying github directory you should be able to re-run these analyses by following along with the code chunks in R Studio. If you download the code separtely or you are using this pipeline on your own data, you may need to change the working directory to where the associated files are housed (i.e. setwd("~/path/to/directory/with/data")).

The data used for this analysis are calculated with SymPortal . The raw Symbiodiniaceae ITS2 sequences obtained from Montastraea cavernosa samples can be found in the NCBI SRA under project number PRJNA579363. Hopefully you are able to follow along with this file and find it useful to use with your own data!

Basic setup of R environment


Loading required packages

For the following analyses we will require the use of a number of different R packages. Most of these can be sourced from CRAN, but a couple need to be downloaded from GitHub or BioConducter. We can use the following code to quickly load in the packages and install any packages not previously installed in the R console.

if (!require("pacman")) install.packages("pacman")

pacman::p_load("dplyr", "edgeR", "ggplot2", "MCMC.OTU", "pairwiseAdonis", "rcartocolor", "RColorBrewer", "Redmonder", "reshape2", "vegan")

pacman::p_load_gh("pmartinezarbizu/pairwiseAdonis/pairwiseAdonis")

if (!require("edgeR")){BiocManager::install("edgeR", update = FALSE)
  library(edgeR)}

options("scipen" = 10)


ITS2 sequences


Loading ITS2 sequence data into R

First, we need to load in the data from SymPortal analysis and clean it up in R. We can order sites from north to south so later data can be plotted shallow to deep; north to south. To do this we can set “Depth_zone” and “Sample_site” as factors and define the order of the factors.

its2Seq = read.delim("62_20190310_DBV_2019-03-11_01-11-25.167036.seqs.absolute.clean.txt", header = TRUE, check.names = FALSE)
head(its2Seq)

its2MetaData = read.delim("CBC_MCAV_sampling_metadata.txt", header = TRUE, check.names = FALSE)
head(its2MetaData)

its2Seq = cbind(its2Seq[1], its2MetaData[,2:3], its2Seq[,c(2:length(its2Seq))])
colnames(its2Seq)[3] = "Depth_zone"
head(its2Seq)

its2Seq$Depth_zone = factor(its2Seq$Depth_zone, levels = c("10", "16", "25", "35"))
levels(its2Seq$Depth_zone)

its2Seq$Sample_site = factor(its2Seq$Sample_site, levels(its2Seq$Sample_site)[c(4, 2, 3, 1)])
its2Seq = its2Seq[order(its2Seq$Sample_site, its2Seq$Depth_zone), ]
levels(its2Seq$Sample_site)

head(its2Seq)
##     sample_name Sample_site Depth_zone noName Clade A noName Clade B
## 107     CBC_107          TR         10              0              0
## 108     CBC_108          TR         10              0              0
## 109     CBC_109          TR         10              0              0
## 110     CBC_110          TR         10              0              0
## 111     CBC_111          TR         10              0              0
## 112     CBC_112          TR         10              0              0
##     noName Clade C noName Clade D noName Clade E noName Clade F noName Clade G
## 107            204              0              0              0              0
## 108          15750              0              0              0              0
## 109           1101              0              0              0              0
## 110          13491              0              0              0              0
## 111          11425              0              0              0              0
## 112           1429              0              0              0              0
##     noName Clade H noName Clade I A13 A4a A4 50815_A 71474_A 45275_A 71448_A
## 107              0              0   0   0  0       0       0       0       0
## 108              0              0   0   0  0       0       0       0       0
## 109              0              0   0   0  0       0       0       0       0
## 110              0              0   0   0  0       0       0       0       0
## 111              0              0   0   0  0       0       0       0       0
## 112              0              0   0   0  0       0       0       0       0
##     71475_A 29923_A 71501_A B18b 71441_B B21 40228_B 44807_B B1 71508_B 71509_B
## 107       0       0       0    0       0   0       0       0  0       0       0
## 108       0       0       0    0       0   0       0       0  0       0       0
## 109       0       0       0    0       0   0       0       0  0       0       0
## 110       0       0       0    0       0   0       0       0  6       0       0
## 111       0       0       0    0       0   0       0       0  0       0       0
## 112       0       0       0    0       0   0       0       0  0       0       0
##     71490_B 71510_B 71511_B 71514_B 71515_B 71516_B B19 40229_B 71512_B 71517_B
## 107       0       0       0       0       0       0   0       0       0       0
## 108       0       0       0       0       0       0   0       0       0       0
## 109       0       0       0       0       0       0   0       0       0       0
## 110       0       0       0       0       0       0   0       0       0       0
## 111       0       0       0       0       0       0   0       0       0       0
## 112       0       0       0       0       0       0   0       0       0       0
##     71518_B 71513_B 71519_B 71520_B 71521_B 71522_B 71523_B 71367_B 71499_B
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0       0       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     71524_B 71525_B 71368_B 71403_B 71526_B 71527_B 71528_B 71402_B 71491_B
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0       0       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     29623_B 71420_B 71369_B 71500_B 71407_B 71408_B 71547_B 71506_B    C3  C3de
## 107       0       0       0       0       0       0       0       0  1729   906
## 108       0       0       0       0       0       0       0       0 92525 30348
## 109       0       0       0       0       0       0       0       0  7587  1269
## 110       0       0       0       0       0       0       0       0 59532 42690
## 111       0       0       0       0       0       0       0       0 52304 39964
## 112       0       0       0       0       0       0       0       0  7106  4657
##      C3bb C21ae  C3an  C3s C3dk C3cd C3dm 71372_C 71371_C 71374_C C3dn 71376_C
## 107   549   207   467  114  103    0    0      37      26      42    0      30
## 108 14205 14597  8941 6955 5609    0    0    3131    1788    1487    0       0
## 109   713   428   601  286  224    0    0      64      67      66    0       0
## 110 20025 18009 10091 8928 7498 4643    0    3452    2498    2165 2303       0
## 111 19281 16220  9980 8003 7245    0    0    2571    1769    1616    0    1540
## 112  1846  1609  1078  611  629    0    0     265     248     209    0     132
##     12353_C C21 71394_C 71377_C  C3b 71442_C 71459_C 71460_C 71458_C 37807_C
## 107       0 114       0       0    0       0       0       0       0       0
## 108    3864   0       0       0 1925       0    1189    1260     939       0
## 109     411  99       0       0  222       0      59      56      69       0
## 110       0   0       0       0    0       0     958    1159    1289       0
## 111       0   0       0       0    0       0       0       0       0       0
## 112       0   0       0       0    0       0       0      99      96     107
##     71397_C 71431_C 71444_C 71392_C 2301_C 71375_C 71386_C 71387_C 71440_C
## 107       0      34       0       0      0       0       0       0       0
## 108       0       0       0       0      0       0       0       0       0
## 109       0       0       0       0      0       0       0       0       0
## 110       0       0       0       0      0       0       0       0       0
## 111    1471       0       0       0      0       0       0       0       0
## 112     163       0       0       0      0       0       0       0       0
##     23653_C 71395_C 71445_C 71413_C 71391_C 71406_C 71443_C 11189_C C1 71379_C
## 107       0       0       0       0       0       0       0       0  0       0
## 108       0       0       0       0       0       0       0     880  0       0
## 109      56       0       0       0       0      79       0      99  0       0
## 110       0       0       0       0       0       0       0       0  0       0
## 111       0       0       0    1320       0       0       0       0  0       0
## 112       0       0       0     110       0       0       0       0  0       0
##     71393_C 71469_C 71411_C 71381_C 71382_C 49051_C 71380_C 25182_C 3031_C
## 107       0      17       0       0       0       0       0       0      0
## 108       0       0       0       0       0       0       0       0      0
## 109       0       0       0       0       0       0       0       0      0
## 110       0       0       0       0       0       0       0       0      0
## 111       0    1138       0       0       0       0       0       0      0
## 112       0       0       0       0       0       0       0       0      0
##     71477_C 71543_C 20889_C 71373_C 71423_C 71422_C 71428_C C3i 71404_C 71446_C
## 107       0       0       0       0       0       0       0   0       0       0
## 108       0       0    1212       0       0       0       0   0       0       0
## 109       0       0      75       0       0       0       0   0       0       0
## 110       0       0    1128       0       0       0       0   0       0       0
## 111       0       0       0       0       0       0       0   0       0       0
## 112       0       0       0       0       0       0       0   0       0       0
##     71426_C 71388_C 71432_C 23920_C 71436_C 71409_C 71430_C 71384_C 71437_C
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0       0       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     7689_C 71414_C 71502_C 71486_C 71396_C 71412_C 71468_C 25087_C 20939_C
## 107      0       0       0       0       0       0       0       0       0
## 108      0       0       0       0       0       0       0       0       0
## 109      0       0       0       0       0       0       0       0       0
## 110      0       0       0       0       0       0       0       0       0
## 111      0       0       0       0       0       0       0       0       0
## 112      0       0       0       0       0       0       0       0       0
##     71435_C 71424_C 71439_C 71390_C 71539_C 25491_C 71505_C C3n 71496_C 71389_C
## 107       0       0       0       0       0       0       0   0       0       0
## 108       0       0       0       0       0       0       0   0       0       0
## 109       0       0       0       0       0       0       0   0       0       0
## 110       0       0       0       0       0       0       0   0       0       0
## 111       0       0       0       0       0       0       0   0       0       0
## 112       0       0       0       0       0       0       0   0       0       0
##     71434_C 71465_C 71415_C 71450_C 71370_C 5436_C 71504_C 71489_C 71548_C
## 107       0       0       0       0      18      0       0       0       0
## 108       0       0       0       0       0      0       0       0       0
## 109       0       0       0       0       0      0       0       0       0
## 110       0       0       0       0       0      0       0       0       0
## 111       0       0       0       0       0      0       0       0       0
## 112       0       0       0       0       0      0       0       0       0
##     71503_C 44082_C 71529_C 71530_C 71451_C 71433_C 71410_C 3461_C 71452_C
## 107       0       0       0       0       0       0       0      0       0
## 108       0       0       0       0       0       0       0      0       0
## 109       0       0       0       0       0       0       0      0       0
## 110       0       0       0       0       0       0       0      0       0
## 111       0       0       0       0       0       0       0      0       0
## 112       0       0       0       0       0       0       0      0       0
##     71487_C 71454_C 71449_C 71544_C 71537_C 71400_C 71495_C 71457_C 71461_C
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0       0       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     71455_C 71533_C C1c 71462_C 71470_C 45080_C 71484_C 71485_C 71538_C 22650_C
## 107       0       0   0       0       0       0       0       0       0       0
## 108       0       0   0       0       0       0       0       0       0       0
## 109       0       0   0       0       0       0       0       0       0       0
## 110       0       0   0       0       0       0       0       0       0       0
## 111       0       0   0       0       0       0       0       0       0       0
## 112       0       0   0       0       0       0       0       0       0       0
##     71545_C 71463_C 71478_C 71534_C 71481_C 71479_C 71438_C 71456_C 71492_C
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0       0       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     71542_C 44826_C 71464_C 71416_C 71401_C 71540_C 71480_C 71476_C 71493_C
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0       0       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     71497_C 71494_C 71532_C 71398_C 71531_C 71541_C 23413_C 71453_C C3.7
## 107       0       0       0       0       0       0       0       0    0
## 108       0       0       0       0       0       0       0       0    0
## 109       0       0       0       0       0       0       0       0    0
## 110       0       0       0       0       0       0       0       0    0
## 111       0       0       0       0       0       0       0       0    0
## 112       0       0       0       0       0       0       0       0    0
##     71466_C 71482_C 71488_C 71405_C 71467_C 71549_C 71425_C 71498_C 71383_C
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0       0       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     C3ad 71546_C 71472_C 19660_C 1813_C 71483_C 892_C 71421_C 9930_C 71419_C
## 107    0       0       0       0      0       0     0       0      0       0
## 108    0       0       0       0      0       0     0       0      0       0
## 109    0       0       0       0      0       0     0       0      0       0
## 110    0       0       0       0      0       0     0       0      0       0
## 111    0       0       0       0      0       0     0       0      0       0
## 112    0       0       0       0      0       0     0       0      0       0
##     71447_C 71417_C 22245_C 71473_C 10133_C 71535_C 71429_C 71378_C 71385_C
## 107       0       0       0       0       0       0       0       0       0
## 108       0       0       0       0       0       0       0       0       0
## 109       0       0       0       0       0       0       0       0       0
## 110       0       0       0       0     842       0       0       0       0
## 111       0       0       0       0       0       0       0       0       0
## 112       0       0       0       0       0       0       0       0       0
##     71418_C 71471_F 71536_G
## 107       0       0       0
## 108       0       0       0
## 109       0       0       0
## 110       0       0       0
## 111       0       0       0
## 112       0       0       0